You are here: Statements and Functions > Entity()
Syntax samples
ENTITY({<expression>})
ENTITY()
ENTITY(Var1)
Returns the name-index number of the current entity or a particular entity in an entity group. This function is especially useful in macros and subroutines that vary depending on which entity calls them. Use ENTITY() to determine what type of entity is processing when an entity type of ALL is specified at a location. For example, if a common area handles several different parts with essentially the same process, use an IF...THEN statement in conjunction with an ENTITY() to have individual statement blocks handle the details of the operation. This function returns an integer.
Speed fields, traveling time fields, conveyor speed fields, Resource fields, operation logic, routing fields, arrival logic, debug user-condition field.
Components
<expression>
The number of the entity in a group to inspect. For example, ENTITY(3) returns the name-index number of the third entity in the group. If this option is omitted, the name-index number of the calling entity is returned.
Example
All cars from the motor pool must be washed after use. All cars except vans require ten minutes to wash, and vans require an additional ten minutes. The logic below models this situation.
Process Table
Entity |
Location |
Operation (min) |
---|---|---|
ALL |
Wash1 |
WAIT 10 min IF ENTITY() = Van THEN WAIT 10 min |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
1 |
ALL |
Parking |
FIRST 1 |
MOVE FOR 30 |
ENT() and LOCATION().